
$(function(){
	$("#myTree").tree({
		url:"tree.json",
		animate:true,
		checkbox:true,
		lines:true,
		dnd:true,
		formatter:function(node){
			console.log(arguments);
			if(node.children){
				var len=node.children.length;
				var text=node.text+"<font color='red'>("+len+")</font>";
				return text;
			}
			return node.text;
		},
		onDblClick:function(node){
			console.log(node);
			console.log("双击事件")
			if(node.state=='open'){
				$("#myTree").tree("collapse",node.target);
			}
			if(node.state=='closed'){
				$("#myTree").tree("expand",node.target);
			}
			
			
		}
			
			
		
		
		
	})
	
});
	
